<html>
<head><meta charset="utf-8"><title>LLVM plugin support in Rust compiler-team#419 · t-compiler/major changes · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/index.html">t-compiler/major changes</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html">LLVM plugin support in Rust compiler-team#419</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="230743659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230743659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230743659">(Mar 17 2021 at 18:33)</a>:</h4>
<p>A new proposal has been announced: <a href="https://github.com/rust-lang/compiler-team/issues/419">LLVM plugin support in Rust #419</a>. It will be announced at the next meeting to try and draw attention to it, but usually MCPs are not discussed during triage meetings. If you think this would benefit from discussion amongst the team, consider proposing a design meeting.</p>



<a name="230807193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230807193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230807193">(Mar 18 2021 at 03:01)</a>:</h4>
<p>This seems reasonable. I think it'd need to stay on nightly for a <em>long</em> time, and might or might not be possible to stabilize, since I don't think we'd be able to offer much in the way of stability guarantees about it.</p>



<a name="230810520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230810520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230810520">(Mar 18 2021 at 03:55)</a>:</h4>
<p>I don't think we should stabilize that rustc uses an LLVM backend at all; that break cg_clif and prevents other implementations from using a backend other than LLVM</p>



<a name="230810524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230810524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230810524">(Mar 18 2021 at 03:55)</a>:</h4>
<p>adding this on nightly seems fine though</p>



<a name="230818678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230818678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230818678">(Mar 18 2021 at 06:24)</a>:</h4>
<p>That wasn't my primary concern; I was already assuming that any such mechanism would have to be conditionally available.</p>



<a name="230818718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230818718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230818718">(Mar 18 2021 at 06:24)</a>:</h4>
<p>My concern was that even after addressing that, it would be likely to break compatibility of the plugin interface regularly.</p>



<a name="230829704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230829704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230829704">(Mar 18 2021 at 08:48)</a>:</h4>
<p>Maybe we could add a generic way to send stringly typed configuration to backends? It would then be the backend's job to error on invalid configuration values</p>



<a name="230830181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230830181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230830181">(Mar 18 2021 at 08:52)</a>:</h4>
<p>That did be <code>-Cllvm-args</code>. I am using it in cg_clif too.</p>



<a name="230837410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230837410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230837410">(Mar 18 2021 at 09:59)</a>:</h4>
<p>I think we can conditionally enable this only when building with system LLVM. that would make me significantly more comfortable with this.</p>



<a name="230896989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230896989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230896989">(Mar 18 2021 at 16:37)</a>:</h4>
<p>system-LLVM-only would work for me, but it does feel weird that a third-party build would be more featureful</p>



<a name="230899054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230899054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230899054">(Mar 18 2021 at 16:50)</a>:</h4>
<p>Could we get a list of all use cases for LLVM plugins? The only I know of currently is annobin, for which I could see value in integrating it in rustc proper. For example an LLVM plugin wouldn't be able to get the list of source files used for the build, while rustc can. It also has overlap with <a href="https://github.com/Shnatsel/rust-audit">https://github.com/Shnatsel/rust-audit</a>.</p>



<a name="230905542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230905542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230905542">(Mar 18 2021 at 17:27)</a>:</h4>
<p>I really want to avoid people relying on us shipping a LLVM as a DSO in any particular shape or form. Were a profilic consumer of rustc (for sake of example lets say Firefox) start relying on a particular version of LLVM we ship, upgrading LLVM would also become significantly more painful – we'd be breaking or need to coordinate whatever upgrades.</p>



<a name="230905750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230905750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230905750">(Mar 18 2021 at 17:28)</a>:</h4>
<p>(I say this as somebody who at some point tried to do <a href="https://github.com/nagisa/llvm_build_utils.rs">something similar</a>)</p>



<a name="230969655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230969655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> William Moses <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230969655">(Mar 19 2021 at 03:11)</a>:</h4>
<p><span class="user-mention" data-user-id="138448">@cuviper</span>  the rust ml group is interested in using Enzyme (<a href="https://github.com/wsmoses/Enzyme">https://github.com/wsmoses/Enzyme</a>) to provide automatic differentiation capabilities for certain codes [obvious bias as both author of this MCP and Enzyme].</p>
<p>Regarding LLVM version nonsense, I would argue that only plugins built for the precise version of LLVM rustc is built agains should be allowed. We might even be able to enforce this if we only allowed plugins built by a specific Rust build process that builds it against the same version of LLVM.</p>



<a name="230979927"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230979927" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230979927">(Mar 19 2021 at 05:55)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> So, I wouldn't want to make it dependent on LLVM version, but I would really like to ship the LLVM associated with a rust build in a sysroot crate.</p>



<a name="230979992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/230979992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#230979992">(Mar 19 2021 at 05:56)</a>:</h4>
<p>Binaries and library. So that you always have a matching clang for cross-language LTO, or a library for bindgen.</p>



<a name="231017705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/231017705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#231017705">(Mar 19 2021 at 12:55)</a>:</h4>
<p>If we were to go that route, the first step would be to make the llvm backend its own distributable component.</p>



<a name="231017864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/LLVM%20plugin%20support%20in%20Rust%20compiler-team%23419/near/231017864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/LLVM.20plugin.20support.20in.20Rust.20compiler-team.23419.html#231017864">(Mar 19 2021 at 12:56)</a>:</h4>
<p>(<a href="https://github.com/rust-lang/rust/pull/81746">https://github.com/rust-lang/rust/pull/81746</a> would pave the way for this)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>